import { get, post } from './http.js'
import axios from "axios"; //引入axios

//获取token
export const getToken = params => post('api1/dex/oauth/extras/token', params);

//获取案件信息
export const getCaseList = params => post('api1/dex/api/data-model/getrecinfo', params);

//获取案件详情
export const getCaseDetails = params => get('api1/eUrbanMIS/openapi/v2/downstream/recmediainfo', params);

//本地测试服务（走不同的代理）
export const getTestData = params => post('api2/WCPS/MAIN/000_000_003', params);

//本地测试服务（获取验证码）
export const getCode = (params) => {
    return post('/WCPS/MAIN/000_000_004', params);
};
// export const getCode = params => post('http://172.26.2.18:3001/WCPS/MAIN/000_000_004', params);

//本地测试服务（登录）
export const login = params => post('/WCPS/MAIN/000_000_005', params);

//本地测试服务（获取session）
// export const session = params => post('api2/WCPS/MAIN/000_000_006', params);

export const session = (params) => {
    return post('/WCPS/MAIN/000_000_006', params);
};


//由经纬度到文字地址及相关位置信息的转换能力
export const getLocationDes = params => get('api3/ws/geocoder/v1/', params);

//独立请求 不走基本配置
export const test01 = (params) => {
    return axios(
        {
            method: 'post',
            baseURL: 'http://172.26.2.18:3001/WCPS/MAIN/',
            url: '/000_000_006',
            timeout: 1000 * 60,
            headers: {
                'Content-Type': 'text/plain;charset=UTF-8',
                'Authorization': 'bearer 987789412312qweqweqweqwesafadfdsf',
            },
            data: params,
            transformRequest: [function (data, headers) {
                // 对发送的 data 进行任意转换处理
                //对象转字符串
                const str = JSON.stringify(data);
                return str;
            }],
            transformResponse: [function (data) {
                // 对接收的 data 进行任意转换处理
                //字符串转对象
                const str = JSON.parse(data);
                return str;
            }],

        }
    )

}